<div id="divStockOutReturnReason<?php echo $site_id; ?>">
    <?php if ($this->data) : ?>
    <?php
            echo $this->element('pageHeader', array(
                'update' => 'divStockOutReturnReason' . $site_id,
                'controller' => 'its_customers',
                'action' => 'display_cust_stock_out_return_reasons',
                'params' => $site_id
            )); ?>
    <?php $cur = $paginator->counter(array('format' => '%start%')); ?>
    <?php endif; ?>
            <table class="data">
                <thead>
                    <tr>
                        <th width="50px"><?php echo 'No'; ?></th>
                        <th><?php echo 'Title'; ?></th>
                        <th class="collect_date"><?php echo 'Collect Date'; ?></th>
                        <th class="collector"><?php echo 'Collector'; ?></th>
                        <th class="action">&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
            <?php if (empty($this->data)) : // ถ้าไม่มีข้อมูล ?>
                <tr>
                    <td colspan="6"><div class="fail-flash">This Site doesn't have any Return Reasons yet.</div></td>
                </tr>
            <? else : // ถ้ามีข้อมูล ?>
            <?php $i = 0;
                    foreach ($this->data as $data): ?>
            <?php
                        $tableCell = array();
                        $nameId = $this->uuid('span', $this->here);
                        $tableCell[] = ++$i;
                        $tableCell[] = $html->tag('span', $data['CSoRR']['title'], array('id' => $nameId));
                        $tableCell[] = $html->tag('span', $data['CSoRR']['modified'], array('class' => 'lower'));
                        $tableCell[] = $html->tag('span', $data['User']['name']);
                        $tableCell[] = $my->confirmLink($html->image('icon/delete.png', array('title' => 'delete', 'alt' => 'delete')), "{$this->name}/delete_cust_stock_out_return_reasons/{$data['CSoRR']['id']}", 'Do you want to delete \"' . $data['CSoRR']['title'] . '\"?', 'divStockOutReturnReason' . $site_id, false);
                        echo $html->tableCells($tableCell, array('class' => 'odd-cell'), array('class' => 'even-cell'));
                        echo $ajax->editor($nameId, "/its_customers/cust_stock_out_return_reason_inplace_editor/name/{$data['CSoRR']['id']}");
            ?>
            <?php endforeach; ?>
            <?php endif; ?>
                        <tr>
                            <td>&nbsp;</td>
                            <td colspan="5">
                    <?php echo $ajax->form('CSoRR', 'post', array('update' => 'divStockOutReturnReason' . $site_id, 'indicator' => 'indicator', 'url' => array('controller' => 'its_customers', 'action' => 'save_cust_stock_out_return_reasons'))); ?>
                    <?php echo $form->text('CSoRR.title'); ?>
                    <?php echo $form->hidden('CSoRR.site_id', array('value' => $site_id)); ?>
                        <span class="toolbar" style="border: none; margin: 0px;">
                        <?php echo $this->element('toolbar', array('buttons' => array('save'))); ?>
                    </span>
                    <?php echo $form->end(); ?>
                    </td>
                </tr>
            </tbody>
        </table>
    <?php echo $this->element('paging'); ?>
    <?php //debug($this->data);  ?>
</div>